package org.hawk.gwt.ppc.utils;


/**
 * Implementation of {@link Pattern} interface that 
 * delegates logic to the java {@link java.util.regex.Pattern}
 * implementation.
 * Subclasses should define public constructor that accepts one {@link String}
 * parameter in order to be a valid pattern implementations.
 * 
 * @author alex.bereznevatiy@gmail.com
 */
public class JavaPattern implements Pattern {
	private java.util.regex.Pattern regex;
	
	public JavaPattern(String regex){
		this.regex = java.util.regex.Pattern.compile(regex);
	}

	public boolean match(String resource) {
		return regex.matcher(resource).matches();
	}
}
